package com.wnxy.admin.controller;

import com.github.pagehelper.PageInfo;
import com.wnxy.admin.common.ResponseResult;
import com.wnxy.admin.dto.CarDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.wnxy.admin.entity.Transaction;
import com.wnxy.admin.service.ITransactionService;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 交易流水表 前端控制器
 * </p>
 *
 * @author All
 * @since 2023-11-29
 */
@RestController
@RequestMapping("/transaction")
public class TransactionController {

    private final ITransactionService transactionServiceImpl;
    public TransactionController(ITransactionService transactionServiceImpl){
        this.transactionServiceImpl = transactionServiceImpl;
    }

    @CrossOrigin
    @GetMapping("/page/{pageNum}/{pageSize}")
    public ResponseResult page(@PathVariable Integer pageNum,
                               @PathVariable Integer pageSize,
                               @RequestParam(required = false) Long keyword) {
        PageInfo<Transaction> page = transactionServiceImpl.getAll(pageNum, pageSize, keyword);
        return ResponseResult.ok(page);
    }
}
